// app.js
App({
  onLaunch() {
    // 获取系统信息
    const systemInfo = wx.getSystemInfoSync();
    // 胶囊位置信息
    const menuButtonInfo = wx.getMenuButtonBoundingClientRect();
    // 导航栏高度 = 状态来到胶囊的间距（胶囊上边距-状态栏高度） * 2 + 胶囊高度 + 状态栏高度
    this.globalData.navBarHeight = (menuButtonInfo.top - systemInfo.statusBarHeight) * 2 + menuButtonInfo.height + systemInfo.statusBarHeight;
    this.globalData.menuButtonBottom = menuButtonInfo.top - systemInfo.statusBarHeight;
    this.globalData.menuButtonHeight = menuButtonInfo.height;
    this.globalData.customNavWidth = systemInfo.screenWidth - menuButtonInfo.width - (systemInfo.screenWidth - menuButtonInfo.right) * 2;
    this.globalData.menuButtonRight = systemInfo.screenWidth - menuButtonInfo.right;
    this.globalData.menuButtonTop =  menuButtonInfo.top;
    console.log(menuButtonInfo,systemInfo)
  },
  globalData: {
    navBarHeight: 0, //导航栏高度
    customNavWidth: 0, // 自定义区域最大宽度
    menuButtonRight: 0, //胶囊右边距
    menuButtonBottom: 0, //胶囊距离下边距
    menuButtonHeight: 0, //胶囊高度
    menuButtonTop: 0, //胶囊top
  }
})
